﻿package mortal.game.view.copy.QuestionCopy
{
    import Engine.RMI.*;
    import Framework.Util.*;
    import Message.Game.*;
    import Message.Public.*;
    import mortal.common.error.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.mvc.core.*;

    public class QuestionCopyProxy extends Proxy
    {

        public function QuestionCopyProxy()
        {
            return;
        }// end function

        public function changeAnswer(param1:int, param2:int) : void
        {
            rmi.iQuestionCopyPrx.changeAnswer_async(new AMI_IQuestion_changeAnswer(this.onchangeAnswerSuccess, this.onFail), param1, param2);
            return;
        }// end function

        private function onchangeAnswerSuccess(param1:AMI_IQuestion_changeAnswer) : void
        {
            return;
        }// end function

        public function useTimesProp(param1:int, param2:int) : void
        {
            rmi.iQuestionCopyPrx.useTimesProp_async(new AMI_IQuestion_useTimesProp(this.onuseTimesPropSuccess, this.onuseTimesPropFail), param1, param2);
            return;
        }// end function

        private function onuseTimesPropSuccess(param1:AMI_IQuestion_useTimesProp) : void
        {
            Cache.instance.question.hasUseTime = Cache.instance.question.useTimeProType;
            Dispatcher.dispatchEvent(new DataEvent(EventName.CopyQuestionUpdateTimes));
            return;
        }// end function

        private function onuseTimesPropFail(param1:Exception) : void
        {
            RMIDispatcher.getInstance().dispatchErrorEvent(param1);
            return;
        }// end function

        public function getQuestionMsgasync() : void
        {
            rmi.iQuestionCopyPrx.getQuestionMsg_async(new AMI_IQuestion_getQuestionMsg(this.getQMsgSuccess, this.ongetQuestionMsFail));
            return;
        }// end function

        private function getQMsgSuccess(param1:AMI_IQuestion_getQuestionMsg, param2:SQuestionMsg) : void
        {
            Cache.instance.question.qestionSyn(param2);
            return;
        }// end function

        private function ongetQuestionMsFail(param1:Exception) : void
        {
            RMIDispatcher.getInstance().dispatchErrorEvent(param1);
            return;
        }// end function

        private function onFail(param1:Exception) : void
        {
            MsgManager.showRollTipsMsg(ErrorCode.getErrorStringByCode(param1.code));
            return;
        }// end function

    }
}
